stage.set_axis(100)
stage.create_grid_overlay(10, "grey")
stage.set_background("soccerfield")
ballx = -80
t = codesters.Teacher()
rands = t.get_parameters_for_function('randint')
try:
tval_1 = rands[0]
except:
tval_1 = "DNE"
try:
tval_2 = bally
except:
tval_2 = "DNE"
t1 = TestObjective()
t1.add_success(tval_1 == ['-100', '100'], "Great job!")
t1.add_failure(tval_1 == "DNE", "Did you drag out a Random Integer tool?")
t1.add_failure(tval_1 == ['1', '10'], "Did you change the integers in the random command to -100, 100?")
t1.add_creative(tval_1 != ['-100', '100'] and tval_1 != "DNE", "That range of numbers is good too!")
t2 = TestObjective()
t2.add_success(tval_2 != "DNE", "Great job!")
t2.add_failure(tval_2 == "DNE", "Did you change the name of the variable to bally?")
tester = TestManager()
tester.add_test_list([t1,t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)